package com.neusoft.ysu.elm02.mapper;

import com.neusoft.ysu.elm02.entity.Emp;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 作者：赵子鉴
 * @since 2023-08-21
 */
@Mapper
public interface EmpMapper extends BaseMapper<Emp> {
    @Select("select * from emp where ename=#{ loginname } and job=#{ password }")
    Emp login(String loginname,String password);

    List<Emp> findAllWithDept();
    //concat是拼接
    @Select("        SELECT DISTINCT job\n" +
        "        FROM emp\n" +
        "        WHERE job like concat( #{ job } , '%' )")
    List<String> findJobByPre(String job);
}
